<!--
  Index of Picture Upload
-->

<%@ page contentType="text/html;charset=UTF-8" %>
<%page_title = "Picture Upload"%>

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="layout" content="main" />
    <title>${page_title}</title>
  </head>
  <body>
  <div class="nav">
            <span class="menuButton"><g:link class="list" action="index">List</g:link></span>
            <span class="menuButton"><g:link class="upload" action="upload">Upload</g:link></span>
  </div>
    <h1 style="margin-left:20px;">${page_title}</h1>
    <p style="margin-left:20px;width:80%">
  <!--fileuploader:form upload="picture"
                     successAction="createPictureUpload"
                     successController="pictureUpload"
                     errorAction="index"
                     errorController="pictureUpload"/-->
</p>
<br /><br />
<h3 style="margin-left:20px;">List of ${page_title}</h3>

<g:if test="${flash.message}">
<div class="message">${flash.message}</div>
</g:if>

<g:each var="f" in="${files}">
  <table>
    <tr>
      <td><b>Name</b></td>
      <td>${f.name}:${p.get(f.id)?.filename}</td>
    </tr>
    <tr>
      <td><b>Path</b></td>
      <td>${f.path}</td>
    </tr>
    <tr>
      <td><b>Size</b></td>
      <td><fileuploader:prettysize size="${f.size}" /> (${f.size})</td>
    </tr>
    <tr>
      <td><b>Extension</b></td>
      <td>${f.extension}</td>
    </tr>
    <tr>
      <td><b>Downloaded</b></td>
      <td>${f.downloads}</td>
    </tr>
    <tr>
      <td><b>Date uploaded</b></td>
      <td><g:formatDate format="MM/dd/yyyy HH:mm" date="${f.dateUploaded}" /></td>
    </tr>
    <!--tr>
      <td></td>
    <td>
    <g:link id="${f.id}" controller="downloadChangeFromPlugin" action="index"
                           errorAction="index"
                           errorController="documentUpload">Click here to download</g:link></td>
    </tr-->
    <tr>
      <td><b>URL</b></td>
    <td>
    http://localhost:8080/telemedicine/downloadChangeFromPlugin/index/${f.id}
    </td>
    </tr>

    <tr>
      <td></td>
      <td>
    <g:link controller="documentUpload" action="delete" id="${f.id}">Click here to delete</g:link>
      </td>
    </tr>
    <tr>
      <td></td>
      <td>
     <g:if test="${f.extension == 'pdf'}">
    <g:link controller="documentUpload" action="pdfshow" id="${f.id}">Click here to Show Pdf</g:link>
    </g:if>
    <g:if test="${f.extension == 'jpg' || f.extension == 'jpeg'}">
    <g:link controller="documentUpload" action="pdfshow" id="${f.id}">Click here to Show Picture</g:link>
    </g:if>
      </td>
    </tr>
    <tr>
      <td>
      <!--embed src="[controller:'downloadChangeFromPlugin',action:'index',id:f.id]"-->
      <!--embed src="/telemedicine/downloadChangeFromPlugin/index/${f.id}"-->
      <td>
    </tr>
  </table>
</g:each>
</body>
</html>
